# -*- coding: utf-8 -*-
from datetime import timedelta
from jms.dm.dm_customer_date_network_level_ticket_detail_dt import jms_dm__dm_customer_date_network_level_ticket_detail_dt
from utils.operators.cluster_for_spark_sql_operator import SparkSqlOperator


jms_dm__dm_customer_new_sign_detail_dt = SparkSqlOperator(
    task_id='jms_dm__dm_customer_new_sign_detail_dt',
    email=['shenjiaming@jtexpress.com','yl_bigdata@yl-scm.com'],
    pool_slots=5,
    master='yarn',
    name='jms_dm__dm_customer_new_sign_detail_dt_{{ execution_date | cst_ds_nodash }}',
    sql='jms/dm/dm_customer_new_sign_detail_dt/execute.hql',
    driver_memory='2G' , 
    executor_memory='2G' , 
    executor_cores=2 , 
    num_executors=3 , 
    yarn_queue='pro',
    conf={'spark.dynamicAllocation.enabled': 'true',  # 动态资源开启
          'spark.shuffle.service.enabled': 'true',  # 动态资源 Shuffle 服务开启
        'spark.dynamicAllocation.maxExecutors'             : 4 , 
          'spark.dynamicAllocation.cachedExecutorIdleTimeout': 60,  # 动态资源自动释放闲置 Executor 的超时时间(s)
          'spark.sql.sources.partitionOverwriteMode': 'dynamic',  # 允许删改已存在的分区
        'spark.executor.memoryOverhead'             : '2G' , 
          },
    hiveconf={'hive.exec.dynamic.partition': 'true',
              'hive.exec.dynamic.partition.mode': 'nonstrict',
              'hive.exec.max.dynamic.partitions.pernode': 5000,
              'hive.exec.max.dynamic.partitions': 30000
              },
    execution_timeout=timedelta(minutes=60),
)

jms_dm__dm_customer_new_sign_detail_dt << jms_dm__dm_customer_date_network_level_ticket_detail_dt
